// pages/modules/peopleAssigned/moreInfo/moreInfo.js
var util = require('../../../../utils/util.js')
var _this, system
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    animation: {},
    currentPage: 0,
    address: '',
    university: '',
    major: ''
  },
  addressFinishedHandle: function(e) {
    console.log('家乡:' + e.detail.content)
    app.userSetting.address = e.detail.content
    _this.genAnimation(-system.windowWidth * 1)
  },
  addressSkipHandle: function (e) {
    _this.genAnimation(-system.windowWidth * 1)
  },
  schoolFinishedHandle: function (e) {
    console.log('school:'+e.detail.content)
    app.userSetting.university = e.detail.content
    //下一步
    _this.genAnimation(-system.windowWidth * 2)
  },
  schoolSkipHandle: function (e) {
    _this.genAnimation(-system.windowWidth * 2)
  },
  majorFinishedHandle: function (e) {
    console.log('major:' + e.detail.content)
    app.userSetting.major = e.detail.content
    wx.navigateBack({
      
    })
  },
  majorSkipHandle: function (e) {
    wx.navigateBack({

    })
  },
  schoolGoPrePage: function () {
    _this.genAnimation(0)
  },
  categoryGoPrePage: function () {
    _this.genAnimation(-system.windowWidth)
  },
  genAnimation: function (offsetX) {
    var animation = wx.createAnimation({
      duration: 300,
      timingFunction: 'ease-in',
      delay: 0
    })
    animation.translateX(offsetX).step()
    _this.setData({
      animation: animation.export()
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    _this = this
    system = wx.getSystemInfoSync()
    _this.setData({
      address: app.userSetting.address,
      university: app.userSetting.university,
      major: app.userSetting.major
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})